<?php



/**
 *
 *
 *
 * @property integer $id
 * @property string $custno
 * @property string $invoice
 * @property string $source
 * @property string $counter
 * @property string $amount
 * @property string $ckno
 * @property string $ckdate
 * @property string $depno
 * @property string $period
 * @property string $debit
 * @property string $credit
 * @property string $type
 * @property string $notes
 * @property string $crserial
 * @property string $entrydate
 * @property string $post
 * @property string $paymethod
 * @property string $entryid
 * @property string $depositdate
 * @property string $appliedfromid
 */
class Payment  extends CFormModel
{

    public $id;
    public $custno;
    public $invoice;
    public $memo;
    public $amount;
    public $ckno;
     public $ckdate;
     public $depno;
    public $period;
    public $debit;
    public $credit;
    public $type;
    public $notes;
    public $crserial;
    public $entrydate;
    public $post;
    public $paymethod ;
    public $entryid;
    public $depositdate;
    public $jobnumber;
    public $isNewRecord;
    public $locno;


    /**
     * Returns the static model of the specified FormModel class.
     * @return Payment the static model class
     */
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }



    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('custno, invoice, source, counter, amount, ckno, depno, period, debit, credit, type, notes, crserial, post, paymethod, entryid, appliedfromid', 'required'),
            array('memo','safe'),
            array('custno', 'length', 'max'=>7),
            array('invoice, amount, depno, debit, credit, paymethod', 'length', 'max'=>10),
            array('source, type, post', 'length', 'max'=>1),
            array('counter, crserial', 'length', 'max'=>5),
            array('ckno', 'length', 'max'=>12),
            array('period', 'length', 'max'=>6),
            array('entryid, appliedfromid', 'length', 'max'=>36),
            array('ckdate, entrydate, depositdate', 'safe'),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('id, custno, invoice, source, counter, amount, ckno, ckdate, depno, period, debit, credit, type, notes, crserial, entrydate, post, paymethod, entryid, depositdate, appliedfromid', 'safe', 'on'=>'search'),
        );
    }



    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'id' => 'ID',
            'custno' => 'Customer',
            'invoice' => 'Invoice',
            'source' => 'Source',
            'counter' => 'Counter',
            'amount' => 'Amount',
            'ckno' => 'Check #',
            'ckdate' => 'Ckdate',
            'depno' => 'Depatment',
            'period' => 'Period',
            'debit' => 'Debit',
            'credit' => 'Credit',
            'type' => 'Type',
            'notes' => 'Notes',
            'crserial' => 'Crserial',
            'entrydate' => 'Entrydate',
            'post' => 'Post',
            'paymethod' => 'Payment method',
            'entryid' => 'Entryid',
            'depositdate' => 'Depositdate',
            'jobnumber' => 'Job',
        );
    }
    public function getPaymentType(){
        return array(
            self::TYPE_NORMAL=>'Normal',
            self::TYPE_PREPAYMENT=>'Deposit/Prepayment'
        );
    }
    const TYPE_NORMAL=1;
    const TYPE_PREPAYMENT=2;
    

}
